

use "$data/clean/clean_main_complete.dta" , replace


loc experiments "z_score_fs  z_fs_engagement z_fs_voice z_fs_connected z_fs_interest "

		   
		   
preserve

clear all
eststo clear
estimates drop _all

set obs 10
qui gen x = 1
qui gen y = 1

loc columns = 0

foreach choice in `experiments' `experiments'  {

    loc ++columns
    qui eststo col`columns': reg x y

}

restore


/* Statistics */

loc colnum = 1
loc colnames ""


foreach choice in `experiments' {

/* Statistics */


 
********************************Panel B*****************************************
	
 xi: reg `choice'  voice_instrumental voice_intrinsic voice_feedback_intrinsic voice_feedback_instrumental  , vce(r) // 
   
   
    sigstar voice_instrumental   , prec(3)
    estadd loc thisstat3 = "`r(bstar)'": col`colnum'
    estadd loc thisstat4 = "`r(sestar)'": col`colnum'
   
    sigstar voice_feedback_instrumental , prec(3)
    estadd loc thisstat6 = "`r(bstar)'": col`colnum'
    estadd loc thisstat7 = "`r(sestar)'": col`colnum'
	
	sigstar  voice_intrinsic , prec(3)
    estadd loc thisstat9 = "`r(bstar)'": col`colnum'
    estadd loc thisstat10 = "`r(sestar)'": col`colnum'
		
	sigstar voice_feedback_intrinsic , prec(3)
    estadd loc thisstat12 = "`r(bstar)'": col`colnum'
    estadd loc thisstat13 = "`r(sestar)'": col`colnum'

		
		 
	qui sum `choice' if control==1
	estadd loc thisstat15 = string(`r(mean)', "%9.2f"): col`colnum'
	
	qui sum `choice' 
    estadd loc thisstat16 = string(`r(N)', "%9.0f"): col`colnum'
	
	
	
    loc ++colnum

	
	
	 
 xi: reg `choice'  voice_instrumental voice_intrinsic voice_feedback_intrinsic voice_feedback_instrumental $control , vce(r) // 
   
   
    sigstar voice_instrumental   , prec(3)
    estadd loc thisstat3 = "`r(bstar)'": col`colnum'
    estadd loc thisstat4 = "`r(sestar)'": col`colnum'
   
    sigstar voice_feedback_instrumental , prec(3)
    estadd loc thisstat6 = "`r(bstar)'": col`colnum'
    estadd loc thisstat7 = "`r(sestar)'": col`colnum'
	
	sigstar  voice_intrinsic , prec(3)
    estadd loc thisstat9 = "`r(bstar)'": col`colnum'
    estadd loc thisstat10 = "`r(sestar)'": col`colnum'
		
	sigstar voice_feedback_intrinsic , prec(3)
    estadd loc thisstat12 = "`r(bstar)'": col`colnum'
    estadd loc thisstat13 = "`r(sestar)'": col`colnum'

		
		 
	qui sum `choice' if control==1
	estadd loc thisstat15 = string(`r(mean)', "%9.2f"): col`colnum'
	
	qui sum `choice' 
    estadd loc thisstat16 = string(`r(N)', "%9.0f"): col`colnum'
	
		
	estadd loc thisstat17 = "X" : col`colnum'
	
	
    loc ++colnum


	}
	

	 

loc rowlabels " " " "  " "Treatment: instrumental" " " " "  "Treatment: instrumental + feedback" " " " " "Treatment: intrinsic" " " " "  "Treatment: intrinsic + feedback" " " " "  "Control mean" "Number of Observations" "Controls" "

loc rowstats ""

forval i = 1/17 {
    loc rowstats "`rowstats' thisstat`i'"
}




esttab col* using "$output/treat_fs_detail.tex", replace cells(none) booktabs nonotes nomtitle compress alignment(c) nogap noobs nobaselevels label stats(`rowstats', labels(`rowlabels')) ///
 mgroups("Voice index"  "Diff through engagement"  "Being heard" "Feels connection" "Party interested" ,  pattern(1 0 1 0 1 0 1 0  1 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))


